<template>
    <div class="shopCar">
        <div class="top" style="over-flow:hidden;">
            <img :src="require('@/assets/shop/back.png')" alt="" class="back" @click="$router.go(-1)" />
            <div class="p" style="text-align:center;width:100%;margin-left:-10%;line-height:20px;">订单发货</div>
        </div>
        <div class="bar">
            <div class="right" style=" border-top: 7px solid #f5f5f5;">
                <div class="total">
                    <span class="title"> 收货人: </span>
                    <input class="inp" type="text" placeholder="请填写用户名" v-model="info.ADDR_PERSON_NAME" />
                </div>
                <div class="total">
                    <span class="title"> 电&nbsp;&nbsp;&nbsp;&nbsp;话:</span>

                    <input class="inp" type="text" placeholder="默认密码不修改" v-model="info.ADDR_PERSON_TEL" />
                </div>
                <div class="total">
                    <span class="title">地&nbsp;&nbsp;&nbsp;&nbsp;址:</span>

                    <input class="inp" type="text" placeholder="请填写开户人真实姓名" v-model="info.ADDRESS" />
                </div>
                <div class="total">
                    <span class="title">快递单号:</span>
                    <input class="inp" type="text" placeholder="请填写快递单号" v-model="danhao" />
                </div>
                <div class="total">
                    <span class="title">快递公司:</span>
                    <select id="orderTimeDataSel" class="inpselect" v-model="kuaidi" @change="save(kuaidi)">
                        <option value="">请选择快递公司</option>
                        <option value="1">圆通快递</option>
                        <option value="10">宅急送</option>
                        <option value="20">韵达快递</option>
                        <option value="30">申通快递</option>
                        <option value="40">顺丰快递</option>
                        <option value="50">百世汇通</option>
                        <option value="60">快捷速递</option>
                        <option value="70">全峰快递</option>
                        <option value="80">中通快递</option>
                        <option value="90">天天快递</option>
                        <option value="91">优速快递</option>
                        <option value="100">邮政快递</option>
                        <option value="101">德邦快递</option>
                        <option value="130">其他</option>
                    </select>
                
                </div>
                <div class="btn" @click="saveinfo"> 保存</div>

            </div>
        </div>
        <!-- 底部栏 -->
        <v-footer2 background="#f2f2f2"></v-footer2>
    </div>
</template>
<script>
import "@/css/shop/main.scss";
import "@/css/shop/info.scss";
import Footer2 from "@/common/travel/_footer2.vue";
import { Toast } from 'vant'
export default {
    components: {
        "v-footer2": Footer2,
    },
    data() {
        return {
            value1: "",
            title1: '请选择',
            info: '',
            option1: [
                { text: "所有", value: "0" },
                { text: "未支付", value: "1" },// value+1
                { text: "已支付", value: "2" },  // value+1
            ],
            kuaidi: '',
            danhao: '',
        };
    },
    created() {
        this.info = this.$route.query.info
    },
    methods: {
        onSubmit() { },
        //点击选项
        save(i) {
            this.kuaidi = i
        },

        saveinfo() {
            let kuaidh = this.danhao
            let gongsi = this.kuaidi
            if(kuaidh==''){
                Toast('快递单号不能为空');
               return false;

            } 
            if(gongsi==''){
                Toast('请选择快递公司');
               return false;
            }
            let obj = {
                api_user: this.$store.state.login.username,
                ID: this.info.ID,
                shopId: 71,
                kuai_di_gong_si_select_ids: gongsi,
                dan_hao: kuaidh,
            };
            this.$dopost('/sysapi/order/FaHuo/', obj, function (response) {
                    if (response.data && typeof (response.data.error) != "undefined" && response.data.error === 0) {
                        Toast('发货成功');
                        // if (this.LOGIN_PASS != '') {
                        //     this.$store.commit('CHANGE_USER', 0, '', '');
                        //     this.$router.replace({ path: '/login' });
                        // }
                    }
                    else { Toast((response.data && response.data.mess) ? response.data.mess : '出错了！'); }
                }.bind(this), true);
        },
    },
};
</script>
